package com.zlz.rocketmq.service;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author: zlz
 * @date: 2021/11/10 22:10
 * @description:
 * @since: JDK1.8
 */
@Component("producerService")
public class ProducerService {
    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    public void send() {
        for (int i = 0; i < 10; i++) {
            rocketMQTemplate.convertAndSend("hello", "你好啊，boy" + i);
        }
    }
}
